import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class GameCard extends StatelessWidget {
  final String imageUrl;
  final String title;
  final String avatar;
  final String views;

  const GameCard({
    required this.imageUrl,
    required this.title,
    required this.avatar,
    required this.views,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 335.w,
      height: 428.h,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(16.r),
      ),
      child: Stack(
        children: [
          // 主图
          ClipRRect(
            borderRadius: BorderRadius.circular(16.r),
            child: Image.asset(
              imageUrl,
              width: 335.w,
              height: 428.h,
              fit: BoxFit.cover,
            ),
          ),
          // 观看人数
          Positioned(
            top: 16.h,
            right: 16.w,
            child: Container(
              padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 4.h),
              decoration: BoxDecoration(
                color: Colors.black.withOpacity(0.5),
                borderRadius: BorderRadius.circular(30.r),
              ),
              child: Row(
                children: [
                  Icon(
                    Icons.visibility_outlined,
                    color: Colors.white,
                    size: 24.sp,
                  ),
                  SizedBox(width: 4.w),
                  Text(
                    views,
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 24.sp,
                    ),
                  ),
                ],
              ),
            ),
          ),
          // 底部信息
          Positioned(
            left: 16.w,
            right: 16.w,
            bottom: 16.h,
            child: Row(
              children: [
                CircleAvatar(
                  radius: 24.r,
                  backgroundImage: AssetImage(avatar),
                ),
                SizedBox(width: 12.w),
                Text(
                  title,
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 28.sp,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
